//
//  BlockDemo.m
//  swift_learning
//
//  Created by aron on 2017/1/15.
//  Copyright © 2017年 arons. All rights reserved.
//

#import "BlockDemo.h"

@implementation BlockDemo

- (void)test {
    NSLog(@"====begin test====");
    
    [self downloadWithResultBlock:^(NSString *result) {
        NSLog(@"==== getresult:  %@", result);
    }];
}

- (void)downloadWithResultBlock:(void(^)(NSString* result))resultBlock {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        dispatch_async(dispatch_get_main_queue(), ^{
            resultBlock(@"{\"name\": 30}");
        });
    });
}

@end
